A video compression technology is widely applied to the Internet, television broadcasting, and communications fields. H.265/High Efficiency Video Coding (HEVC) is a new international video coding standard. HEVC uses a hybrid coding framework with block-based motion compensation and discrete cosine transform (DCT).
For HEVC, a coding process mainly includes prediction, transformation, quantization, and entropy coding, and a decoding process mainly includes entropy decoding, prediction, dequantization, and inverse transformation.
In the coding process, a predicted pixel for an original pixel corresponding to a current code block is generated during prediction using a reconstructed pixel of a coded region, and a prediction manner mainly includes intra-frame prediction and inter-frame prediction, during transformation, a residual, which is a pixel value difference between the original pixel and the predicted pixel, is transformed to a transform coefficient, during quantization, quantization processing is performed on the transform coefficient, during entropy coding, a quantized transform coefficient and coding scheme information are transformed into a code stream by means of entropy coding processing.
In the decoding process entropy decoding processing is performed on a code stream to parse out coding scheme information and the quantized transform coefficient during entropy decoding, during prediction, the coding scheme information and the decoded reconstructed pixel are used to obtain the predicted pixel, during dequantization, the quantized transform coefficient is dequantized to obtain a reconstructed transform coefficient, during inverse transformation, inverse transformation is performed on the reconstructed transform coefficient to obtain reconstructed residual information, and then the reconstructed residual information and the predicted pixel are added to obtain a reconstructed pixel in order to recover a video image.
For lossy encoding, a reconstructed pixel and an original pixel may be different, and a value difference between the reconstructed pixel and the original pixel is referred to as distortion. Visual entropy masking effect indicates that human eyes are less sensitive to a complex region than to a simple region, and compared with that in a relative flat region, signal distortion that happens in a complex region is more difficult to observe or has weaker visual intensity.
Based on the foregoing theory, to improve overall efficiency of coding a video image, relatively fine quantization is performed in the complex region, and relatively coarse quantization is performed in the simple region. In the coding process, the complex region is usually divided into blocks of relatively small sizes for performing coding, and the flat region is usually divided into blocks of relatively large sizes for performing coding. For a block of a relatively small size, a quantization step size is properly increased in the quantization process. For a block of a relatively large size, a quantization step size is properly decreased in the quantization process. That is, in the quantization process, different quantization step sizes are used in all regions of an image. Compared with a uniform quantization step size, different quantization step sizes help improve overall visual quality of a coded image.
Currently, in a disclosed video coding/decoding scheme, a coding device analyzes a video sequence, determines a quantization parameter of each code block (including quantization step size regulation information of each code block), and writes the quantization parameter into a code stream. A decoding device determines a quantization step size of each code block according to the quantization parameter obtained by parsing the code stream, and completes transform coefficient dequantization processing. However, this solution has a disadvantage. The decoding device can determine, based on the quantization step size regulation information in the code stream, a quantization step size of each code block only when the code stream sent by the coding device carries the quantization step size regulation information of each coding block in order to perform dequantization on a transform coefficient. Coding efficiency is reduced because the code stream carries the quantization step size regulation information of each code block.